import type {
  FC,
  ReactNode,
} from 'react'
import {
  FormValue,
  ModelTypeEnum,
} from '../declarations'
import type { TriggerProps } from './trigger'
import LLMModelParameterModal from './llm-model-parameter-model'
import TTSModelParameterModal from './tts-model-parameter-model'
import Speech2textModelParameterModal from './speech2text-model-parameter-model'
import EmbeddingModelParameterModal from './embedding-model-parameter-model'

export type ModelParameterModalProps = {
  popupClassName?: string
  portalToFollowElemContentClassName?: string
  isAdvancedMode: boolean
  mode: string
  modelType: ModelTypeEnum
  modelId: string
  provider: string
  setModel: (model: { modelId: string; provider: string; mode?: string; features?: string[] }) => void
  completionParams: FormValue
  onCompletionParamsChange: (newParams: FormValue) => void
  hideDebugWithMultipleModel?: boolean
  debugWithMultipleModel?: boolean
  onDebugWithMultipleModelChange?: () => void
  renderTrigger?: (v: TriggerProps) => ReactNode
  readonly?: boolean
  isInWorkflow?: boolean
}
const ModelParameterModal: FC<ModelParameterModalProps> = (props) => {

  if (props.modelType === ModelTypeEnum.textGeneration) {
    return <LLMModelParameterModal {...props}></LLMModelParameterModal>
  } else if (props.modelType === ModelTypeEnum.tts) {
    return <TTSModelParameterModal {...props}></TTSModelParameterModal>
  } else if (props.modelType === ModelTypeEnum.speech2text) {
    return <Speech2textModelParameterModal {...props}></Speech2textModelParameterModal>
  } else if (props.modelType === ModelTypeEnum.textEmbedding) {
    return <EmbeddingModelParameterModal {...props}></EmbeddingModelParameterModal>
  } else {
    return <LLMModelParameterModal {...props}></LLMModelParameterModal>
  }
}

export default ModelParameterModal
